home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac 1
/
Ian and Stuart's One (Australia).iso
/
Australasian Legends
/
Commercial
/
Rainbow Hill
/
MacDOS™ 2.0.0
/
batches
/
errcode.bat
< prev
next >
Wrap
DOS Batch File
|
1994-08-31
|
2KB
|
57 lines
@echo off
! errcode.bat Finds the error code corresponding to a given error message
!
! errcode message
!
! where 'message' is the message (or the beginning of the message) of which we
! need the error code.
!
! DO NOT USE AS ARGUMENTS STRINGS LONGER THAN ABOUT 50 CHARACTERS, otherwise
! the batch will fail because some commands will exceed the maximum length of
! 127 characters.
!
! Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
!
! ensure that the first parameter is there and that the second one is not
set doserr=13
if not "%2x" == "x" goto ERR_LBL
if "%1x" == "x" goto ERR_LBL
! ensure that the first parameter is non-numeric
set errcode_check=z%1
incr errcode_check by 1
set errcode_mess=%1
incr errcode_mess by 1
incr -errcode_mess by z
if not "%errcode_mess%" == "%errcode_check%" goto ERR_LBL
! loop through all the error codes until a match is found
set errcode_check=%1
set doserr=72
set errcode_value=0
:NEXT_CODE_LBL
if not %doserr% == 72 goto ERR_LBL
onerror NO_MATCH_LBL
incr errcode_value
show %errcode_value% errcode_mess
decr -errcode_mess by "%errcode_check%"
show %errcode_value% errcode_mess
echo %errcode_value%: "%errcode_mess%"
goto DONE_LBL
:NO_MATCH_LBL
if not %doserr% == 72 goto ERR_LBL
onerror NEXT_CODE_LBL
incr errcode_mess by z
decr errcode_mess by "%errcode_value%z"
echo "%1" does not correspond to any error code
goto DONE_LBL
:ERR_LBL
show %doserr%
:DONE_LBL
set errcode_check=
set errcode_value=
set errcode_mess=